package com.muxi.association.enums;

import com.baomidou.mybatisplus.annotation.EnumValue;
import com.fasterxml.jackson.annotation.JsonValue;

/**
 * @author ZXW
 */

public enum ActivityLevelEnum {

    SCHOOL_LEVEL(1, "院系级"),
    HOSPITAL_LEVEL(2, "校级"),
    PROVINCE_LEVEL(3, "省级"),
    NATION_LEVEL(4, "国家级");

    @EnumValue
    private Integer level;

    @JsonValue
    private String value;

    ActivityLevelEnum(Integer level, String value) {
        this.level = level;
        this.value = value;
    }

    public Integer getLevel() {
        return level;
    }

    public void setLevel(Integer level) {
        this.level = level;
    }

    public String getValue() {
        return value;
    }

    public void setValue(String value) {
        this.value = value;
    }

    public static ActivityLevelEnum match(int key) {
        for (ActivityLevelEnum s : values()) {
            if (s.getLevel() == key) {
                return s;
            }
        }

        return null;
    }

    public static ActivityLevelEnum catchValue(String value) {
        for (ActivityLevelEnum s : values()) {
            if (s.getValue().equals(value)) {
                return s;
            }
        }
        return null;
    }
}
